<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>

    <script>
        //1.创建字符串 border-right-color  输出  borderRightColor 
        // let str = "border-right-color";

        // function stringToCamel(str) {
        //     let temp = str.split("-");
        //     let newStr = temp[0]
        //     for (let i = 1; i < temp.length; i++) {
        //         newStr += temp[i][0].toUpperCase() + temp[i].slice(1)
        //     }
        //     return newStr;
        // }
        // let x = stringToCamel(str);
        // console.log(x)



        //2.找出字符串种字符出现的最多的字符，输出出现次数+字符
        let str = "abcdaaallllllllllllllllllllllllefgaaa";

        function strMax(str) {
            let obj = {};
            let max = 0;
            let maxStr = "";
            for (let i = 0; i < str.length; i++) {
                if (obj[str[i]]) {
                    obj[str[i]]++
                } else {
                    obj[str[i]] = 1
                }
            }
            console.log(obj)
            for (let key in obj) {
                if (max < obj[key]) {
                    max = obj[key]
                    maxStr = key
                }
            }

            return "出现最多的字符是：" + maxStr + ",出现的次数是：" + max
        }

        console.log(strMax(str))
    </script>
</body>

</html>